package com.lancer.cloud.common.base.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lancer.cloud.common.base.mapper.BaseMapper;
import com.lancer.cloud.common.base.service.BaseService;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * 基础服务实现类
 *
 *@author  caijinbang
 * @date 2019-06-15 22:43
 */
public class BaseServiceImpl<K extends BaseMapper<T>, T> extends ServiceImpl<K , T> implements BaseService<T> {

    @Autowired
    protected  K baseMapper;

    /**
     * 根据条件分页查询
     *
     * @param condition 条件
     * @return 分页结果
     */
    @Override
    public IPage findPageByCondition(Page<T> condition) {
        return baseMapper.findPageByCondition(condition);
    }

    /**
     * 根据条件统计分页总数
     *
     * @param condition 条件
     * @return 总数
     */
    @Override
    public Integer countByCondition(Page<T> condition) {
        return baseMapper.countByCondition(condition);
    }
}
